/**
 * 
 */
package com.roc.util.constant;

import java.util.LinkedHashMap;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

/**
 * @author chenkai 
 */
public enum TerminalName {
	 
	 NAME_S98("S98","02-1"),
	 NAME_8210("8210","03-1"),
	 NAME_8110("8110","03-2"),
	 NAME_E330("E330","05-1"),
	 NAME_E550("E550","05-2"),
	 NAME_E350("E350","05-3"),
	 NAME_S90("S90","01-1"),
	 NAME_S58("S58","01-2"),
	 NAME_WP50("WP50","04-1"),
	 NAME_S_980("S-980","04-2"),
	 NAME_ME31S("ME31S","06-1"),
	 NAME_A6("A6","07-1"),
	 NAME_S500("S500","08-1")
	 ;
	 
	 
	 
	private String code;
	private String name;
	private boolean editAble;
	private boolean enabled;

	private TerminalName( String name,String code) {
		this.code = code;
		this.name = name;
		
	}

	public boolean isEditAble() {
		return editAble;
	}

	public boolean isEnabled() {
		return enabled;
	}

	public String getCode() {
		return code;
	}

	public String getName() {
		return name;
	}

	public static TerminalName valueOfCode(String code) {
		if (StringUtils.isBlank(code)) {
			throw new IllegalArgumentException("TerminalName code " + code
					+ " is blank");
		}
		for (TerminalName ms : values()) {
			if (ms.getCode().equals(code)) {
				return ms;
			}
		}
		throw new IllegalArgumentException("TerminalName code " + code
				+ " is not exist");
	}
	
	
	/**
	 * 获取所有的枚举,以MAP返回
	 * @return
	 */
	public static Map<String,String> getAllEnumMap() {
		
		Map<String,String> map = new LinkedHashMap<String,String>();
		
		for (TerminalName mt : values()) {
			map.put(mt.getCode(),mt.getName());
		}
		
		return map;
		
	}

}
